﻿/***************************************************************************
//* Foxit Software Inc.
//* Copyright(C) 2005-2012, all rights reserved.
//*
//* The following code is copyrighted and contains proprietary information
/* and trade secrets of Foxit Software Inc.      
**************************************************************************
*/

/**
* 简单的图片延迟加载
*/

define(function (require, exports, module) {
    var FXREADER = require('./FXReader.js');
    require('./PDFView/ImgPageViewRender.js');
    FXREADER.CImgLazyLoad = function (url,curPageView, callback, failed_callback) {
    	$.ajax({
			url: url,
			ifModified:true,
			error:function(XMLHttpRequest, textStatus, errorThrown){
				 failed_callback(curPageView);
			},
			success:function(data,textStatus){
				if((data==FXREADER.PDFView.GetImageErrorCode.ERROR_PAGE_DISPLAY_LIMIT.toString()
						|| data==FXREADER.PDFView.GetImageErrorCode.ERROR_CREATE_IMG_FAILED.toString()
						|| data==FXREADER.PDFView.GetImageErrorCode.ERROR_INPROGRESS.toString())
						&& textStatus=="success")
					callback(curPageView,data);
				else
					 callback(curPageView);
			}
		});
    };
    return FXREADER.CImgLazyLoad;
});